package five_class_design_creational_patterns.six_PrototypePattern.deep;

import java.io.*;

/**
 * @author 北巷_东坡
 * @date 2022/10/16 10:27
 * @computer 10741
 */
public class Customer_LDP implements Serializable {
    private Adress_LDP adress_ldp = null;
    public Customer_LDP(){
        this.adress_ldp=new Adress_LDP();
    }

    public  Object deepClone() throws IOException,ClassNotFoundException, OptionalDataException{
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
        objectOutputStream.writeObject(this);

        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(outputStream.toByteArray());
        ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
        return (objectInputStream.readObject());
    }

    public Adress_LDP getAdress_ldp() {
        return this.adress_ldp;
    }

    public void display(){
        System.out.println("查看IP地址");
    }
}
